﻿<Window x:Class="ETWController.UI.ETWControllerConfiguration"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ui="clr-namespace:ETWController.UI"
        Title="Configuration Settings" Height="399.641" Width="571">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Validation.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="110"/>
            <RowDefinition Height="130"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="40"/>
        </Grid.RowDefinitions>
        <GroupBox Grid.Row="0" Header="Network">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="150"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="20"/>
                    <RowDefinition Height="5"/>
                    <RowDefinition Height="20"/>
                    <RowDefinition Height="5"/>
                    <RowDefinition Height="20"/>
                    <RowDefinition Height="5"/>
                    <RowDefinition Height="20"/>
                    <RowDefinition Height="5"/>
                </Grid.RowDefinitions>
                <Label Margin="0,-5,0,0" Grid.Column="0">Remote Host</Label>
                <TextBox Grid.Column="1" Text="{Binding Host}" ToolTip="Remote host to send the hooked keyboard and mouse events." KeyboardNavigation.TabIndex="0" />
                <Label Margin="0,-5,0,0" Grid.Column="0" Grid.Row="2">Port Number</Label>
                <TextBox Grid.Column="1" Grid.Row="2" Validation.ErrorTemplate="{StaticResource portValidation}" Style="{StaticResource textBoxInError}" ToolTip="Over this port are the captured mouse and keyboard events sent." KeyboardNavigation.TabIndex="1" >
                    <TextBox.Text>
                        <Binding Path="PortNumber" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay" >
                            <Binding.ValidationRules>
                                <ui:PortnumberValidator Min="500" Max="65000"/>
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>
                <Label Margin="0,-5,0,0" Grid.Column="0" Grid.Row="4">Secondary Port</Label>
                <TextBox Grid.Column="1" Grid.Row="4" Validation.ErrorTemplate="{StaticResource portValidation}" Style="{StaticResource textBoxInError}" ToolTip="Over this port the WCF service does exchange its messages to control and query trace sesssions. If it does not work try to disable the firewall on the server." KeyboardNavigation.TabIndex="2" >
                    <TextBox.Text>
                        <Binding Path="WCFPort" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay" >
                            <Binding.ValidationRules>
                                <ui:PortnumberValidator Min="500" Max="65000"/>
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>
            </Grid>

        </GroupBox>
        <GroupBox Grid.Row="1" Header="Screenshot">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="150"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="20"/>
                    <RowDefinition Height="5"/>
                    <RowDefinition Height="20"/>
                    <RowDefinition Height="5"/>
                    <RowDefinition Height="20"/>
                    <RowDefinition Height="5"/>
                    <RowDefinition Height="20"/>
                </Grid.RowDefinitions>
                <Label Margin="0,-5,0,0" Grid.Row="0" Grid.Column="0" >Screenshot Directory</Label>
                <TextBox Grid.Row="0" Grid.Column="1" Text ="{Binding ScreenshotDirectoryUnexpanded}"  ToolTip="Screenshots files are saved to this directory." KeyboardNavigation.TabIndex="3" />
                <Label Margin="0,-5,0,0" Grid.Row="2" Grid.Column="0" >Jpg Compression (0-100)</Label>
                <TextBox  Grid.Row="2" Grid.Column="1"  Validation.ErrorTemplate="{StaticResource portValidation}" Style="{StaticResource textBoxInError}" ToolTip="The JPG compression level can be a value between 0-100. 100 is no compression." KeyboardNavigation.TabIndex="4">
                    <TextBox.Text>
                        <Binding Path="JpgCompressionLevel" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay" >
                            <Binding.ValidationRules>
                                <ui:PortnumberValidator Min="0" Max="100"/>
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>
                <Label Margin="0,-5,0,0" Grid.Row="4" Grid.Column="0" >Screenshot Timer in ms</Label>
                <TextBox  Grid.Row="4" Grid.Column="1"  Validation.ErrorTemplate="{StaticResource portValidation}" Style="{StaticResource textBoxInError}" ToolTip="Time in ms between two screenshots regardless if a mouse click or keyboard press did happen (100ms-60000ms)." KeyboardNavigation.TabIndex="4">
                    <TextBox.Text>
                        <Binding Path="ForcedScreenshotIntervalinMs" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay" >
                            <Binding.ValidationRules>
                                <ui:PortnumberValidator Min="100" Max="60000"/>
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>
                <Label Margin="0,-5,0,0" Grid.Row="6" Grid.Column="0" >Keep last N Screenshots</Label>
                <TextBox  Grid.Row="6" Grid.Column="1"  Validation.ErrorTemplate="{StaticResource portValidation}" Style="{StaticResource textBoxInError}" ToolTip="If in screenshot directory more than N files are present the oldest ones are deleted until no more than N files are in the screenshot directory." KeyboardNavigation.TabIndex="4">
                    <TextBox.Text>
                        <Binding Path="KeepNNewestScreenShots" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay" >
                            <Binding.ValidationRules>
                                <ui:PortnumberValidator Min="100" Max="60000"/>
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>

            </Grid>
        </GroupBox>
        <GroupBox Grid.Row="2" Header="Trace Viewer">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="150"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="20"/>
                </Grid.RowDefinitions>
                <Label Margin="0,-5,0,0" Grid.Row="0" Grid.Column="0" >Trace Open Command</Label>
                <TextBox Grid.Row="0" Grid.Column="1" Text ="{Binding TraceOpenCmdLine}"  ToolTip="This is the command line used to open a trace file. The variable $TraceFile is expanded to the current etl output file name. The current working directory is the location of ETWController.exe" KeyboardNavigation.TabIndex="3" />
            </Grid>
        </GroupBox>
        <StackPanel Grid.Row="3"  Orientation="Horizontal" HorizontalAlignment="Center">
            <Button Width="50" Click="Ok" IsDefault="True" KeyboardNavigation.TabIndex="3" Content="Ok" />
            <Button Width="50" Margin="10,0,0,0" Click="Cancel" KeyboardNavigation.TabIndex="4" Content="Cancel" />
        </StackPanel>
    </Grid>
</Window>
